/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package load.education;

import core.DispatcherPort;
import core.StdNode;
import core.TriggerPort;

/**
 *
 * @author Ben
 */
public class SetOrientation extends StdNode{
    private DispatcherPort done = new DispatcherPort();

    public SetOrientation() {
        this.autoPutPorts();
        String[] orientations = {"North","East","South","West"};
        for(final String orientation: orientations){
            TriggerPort set = new TriggerPort() {
                @Override
                public void callInternal() {
                    controller.StdDraw.getInstance().getTurtle().setOrientation(orientation);
                    done.callTargets();
                }
            };
            this.putPort("set"+orientation, set);
        }
    }

}